new Vue({
    el: '#app',
    data() {
        return {
            rules: {

            },
            form: {
                Sales_Inventory_SerialNumber: "",
                // Type_Date: '0',
                Start_Date: '',
                End_Date: '',
                Enterprise_Info_SerialNumber: $.cookie("enterprise"),
                Children: {
                    sales_article_inventory: [{
                        Sales_Article_Inventory_SerialNumber: "",
                        Sales_Inventory_SerialNumber: "",
                        Article_SerialNumber: '', //适用商品
                        Distribute: '', //库存数量
                    }]
                }
            },
            arr: [{
                value: '0',
                label: '指定分销金额'
            }, {
                value: '1',
                label: '根据订单成交额的百分比'
            }],
            article: [],
            loading: false,
            dialogVisible: false,
            dialogVisible1: false,
            dialogImageUrl: '',
            fileXlsx: [],
            tableData: [],
        }
    },
    mounted() {
        this.getData()
    },
    methods: {
        getData() {
            let _this = this
            $.ajax({
                type: 'POST',
                data:{
                    Data: 'article_info'
                },
                url: DomainName + '/getInquiryAction?token=' + $.cookie("token"),
                success: function (res) {
                    _this.article = res;
                    console.log('res',res);
                },
                complete: function (XMLHttpRequest) {
                    _this.loading = false
                    if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                        window.parent.document.location.href = absolutepath() + XMLHttpRequest.getResponseHeader("CONTENTPATH");
                    }
                },
                dataType: "json"
            });
        },
        add_sales_article_inventory() {
            this.form.Children.sales_article_inventory.push({ //销售价格单适用店铺
                Sales_Article_Inventory_SerialNumber: "",
                Sales_Inventory_SerialNumber: "",
                Article_SerialNumber: '', //适用商品
                Distribute: '', //库存数量
            })
        },
        remove_sales_article_inventory() {
            if (this.form.Children.sales_article_inventory.length > 1) {
                this.form.Children.sales_article_inventory.pop()
            } else {
                this.$message({
                    message: '不能在删除了',
                    type: 'warning'
                })
            }
        },
        handle(e) {
            if (e == '1') {
                this.form.End_Date = ''
            }
        },
        submitForm(formName) {
            let _this = this
            this.$refs[formName].validate((valid) => {
                if (valid) {
                    _this.loading = true
                    $.ajax({
                        url: DomainName + '/getAddAction?token=' + $.cookie('token'),
                        type: 'POST',
                        data: {
                            Data: JSON.stringify({
                                sales_inventory: [_this.form]
                            }),
                        },
                        success: function (res) {
                            console.log('提交结果', res)
                            _this.$message.success("提交成功")
                            window.history.go(-1);
                        },
                        error: function () {
                            _this.$message.error("操作失败，请稍后再试")
                        },
                        complete: function (XMLHttpRequest) {
                            _this.loading = false
                            if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                                window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
                            }
                        }
                    })
                } else {
                    console.log("error submit!!");
                    return false;
                }

            });
        },
        resetForm(formName) {
            this.$refs[formName].resetFields();
        },
        onExcel() {
            this.dialogVisible1 = true
          },
          // 商品规格图片
          Specifications(file) {
            let _this = this
            let num = 1
            if (file.size > 150000 && file.size < 500000) {
              num = 0.4
            } else if (file.size > 500000) {
              num = 0.2
            }
            console.log(file);
            new Compressor(file, {
              quality: num,
              success(file) {
                const formData = new FormData();
                formData.append('file', file, file.name);
                let oFileReader = new FileReader();
                oFileReader.readAsDataURL(file);
                oFileReader.onload = function (e) {
                  $.ajax({
                    type: 'POST',
                    url: DomainName + '/FileList',
                    data: {
                      Data: e.target.result,
                      DataLength: file.size,
                      FileName: file.name
                    },
                    complete: function (XMLHttpRequest) {
                      _this.loading = false
                      if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                        window.parent.document.location.href = absolutepath()  + XMLHttpRequest.getResponseHeader("CONTENTPATH");
                      }
                    },
                    success: function (Result) {
                      if (Result.Status == "success") {
                        _this.form.Children.article_specifications[_this.Specification].pic = e.target.result
                        _this.form.Children.article_specifications[_this.Specification].Picture_URL = Result.Picture_Url
                        _this.$message.success('上传成功')
                      } else {
                        _this.$message.error('上传失败')
                      }
                    },
                    error: function () {
                      _this.$message.error("操作失败，请稍后再试")
                    },
                    dataType: "json"
                  });
                }
              },
              error(err) {
                console.log(err.message);
              },
            });
          },
          //商品封面图片
          uploadFront(file) {
            let _this = this
            let num = 1
            // if (file.size > 150000 && file.size < 500000) {
            //   num = 0.4
            // } else if (file.size > 500000) {
            //   num = 0.2
            // }
            new Compressor(file, {
              quality: num,
              // if(file.size) {
              // }
              success(file) {
                console.log(file.size)
                const formData = new FormData();
                formData.append('file', file, file.name);
                let oFileReader = new FileReader();
                oFileReader.readAsDataURL(file);
                oFileReader.onload = function (e) {
                  $.ajax({
                    type: 'POST',
                    url: DomainName + '/FileList',
                    data: {
                      Data: e.target.result,
                      DataLength: file.size,
                      FileName: file.name
                    },
                    complete: function (XMLHttpRequest) {
                      _this.loading = false
                      if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                        window.parent.document.location.href = absolutepath()  + XMLHttpRequest.getResponseHeader("CONTENTPATH");
                      }
                    },
                    success: function (Result) {
                      _this.form.pic = e.target.result
                      if (Result.Status == "success") {
                        _this.form.Picture_URL = Result.Picture_Url
                        _this.$message.success('上传成功')
                        console.log(Result.Picture_Url);
                      } else {
                        _this.$message.error('上传失败')
                      }
                    },
                    error: function () {
                      _this.$message.error("操作失败，请稍后再试")
                    },
                    dataType: "json"
                  });
                }
              },
              error(err) {
                console.log(err.message);
              },
            });
          },
          //商品条码
          uploadBarcode(file) {
            let _this = this
            this.fileList2.push({
              BarCode: '',
              Article_SerialNumber: '',
              Picture_Order: this.fileList.length + 1,
              Picture_Url: '',
              pic: ''
            })
            let num = 1
            if (file.size > 150000 && file.size < 500000) {
              num = 0.4
            } else if (file.size > 500000) {
              num = 0.2
            }
            new Compressor(file, {
              quality: num,
              success(file) {
                const formData = new FormData();
                formData.append('file', file, file.name);
                let oFileReader = new FileReader();
                oFileReader.readAsDataURL(file);
                oFileReader.onload = function (e) {
                  _this.fileList2[_this.fileList2.length - 1].pic = e.target.result
                  $.ajax({
                    type: 'POST',
                    url: DomainName + '/FileList',
                    data: {
                      Data: e.target.result,
                      DataLength: file.size,
                      FileName: file.name
                    },
                    complete: function (XMLHttpRequest) {
                      _this.loading = false
                      if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                        window.parent.document.location.href = absolutepath()  + XMLHttpRequest.getResponseHeader("CONTENTPATH");
                      }
                    },
                    success: function (Result) {
                      if (Result.Status == "success") {
                        _this.fileList2[_this.fileList2.length - 1].Picture_Url = Result.Picture_Url
                        _this.$message.success('上传成功')
                      } else {
                        _this.$message.error('上传失败')
                      }
                    },
                    error: function () {
                      _this.$message.error("操作失败，请稍后再试")
                    },
                    dataType: "json"
                  });
                }
              },
              error(err) {
                console.log(err.message);
              },
            });
          },
          //商品主图轮播图片
          uploadBanner(file) {
            let _this = this
            this.fileList.push({
              article_picNumber: '',
              Article_SerialNumber: '',
              Picture_Order: this.fileList.length + 1,
              Picture_Type: '0',
              Picture_Url: '',
              pic: ''
            })
            let num = 1
            if (file.size > 150000 && file.size < 500000) {
              num = 0.4
            } else if (file.size > 500000) {
              num = 0.2
            }
            new Compressor(file, {
              quality: num,
              success(file) {
                const formData = new FormData();
                formData.append('file', file, file.name);
                let oFileReader = new FileReader();
                oFileReader.readAsDataURL(file);
                oFileReader.onload = function (e) {
                  $.ajax({
                    type: 'POST',
                    url: DomainName + '/FileList',
                    data: {
                      Data: e.target.result,
                      DataLength: file.size,
                      FileName: file.name
                    },
                    complete: function (XMLHttpRequest) {
                      _this.loading = false
                      if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                        window.parent.document.location.href = absolutepath()  + XMLHttpRequest.getResponseHeader("CONTENTPATH");
                        _this.$message(Result.Picture_Url)
                      }
                    },
                    success: function (Result) {
                      _this.fileList[_this.fileList.length - 1].pic = e.target.result
                      if (Result.Status == "success") {
                        _this.fileList[_this.fileList.length - 1].Picture_Url = Result.Picture_Url
                        _this.$message.success('上传成功')
                      } else {
                        _this.$message.error('上传失败')
                      }
                    },
                    error: function () {
                      _this.$message.error("操作失败，请稍后再试")
                    },
                    dataType: "json"
                  });
                }
              },
              error(err) {
                console.log(err.message);
              },
            });
          },
          //商品详情图片
          uploadDetails(file) {
            let _this = this
            this.fileList1.push({
              article_picNumber: '',
              Article_SerialNumber: '',
              Picture_Order: this.fileList1.length + 1,
              Picture_Type: '1',
              Picture_Url: '',
              pic: ''
            })
            let num = 1
            if (file.size > 150000 && file.size < 500000) {
              num = 0.4
            } else if (file.size > 500000) {
              num = 0.2
            }
            new Compressor(file, {
              quality: num,
              success(file) {
                const formData = new FormData();
                formData.append('file', file, file.name);
                let oFileReader = new FileReader();
                oFileReader.readAsDataURL(file);
                oFileReader.onload = function (e) {
                  $.ajax({
                    type: 'POST',
                    url: DomainName + '/FileList',
                    data: {
                      Data: e.target.result,
                      DataLength: file.size,
                      FileName: file.name
                    },
                    complete: function (XMLHttpRequest) {
                      if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                        window.parent.document.location.href = XMLHttpRequest.getResponseHeader("CONTENTPATH");
                      }
                    },
                    success: function (Result) {
                      _this.fileList1[_this.fileList1.length - 1].pic = e.target.result
                      if (Result.Status == "success") {
                        _this.$message.success('上传成功')
                        _this.fileList1[_this.fileList1.length - 1].Picture_Url = Result.Picture_Url
                      } else {
                        _this.$message.error('上传失败')
                      }
                    },
                    error: function () {
                      _this.$message.error("操作失败，请稍后再试")
                    },
                    dataType: "json"
                  });
                }
              },
              error(err) {
                console.log(err.message);
              },
            });
          },
          //查看图片
          handlePictureCardPreview(file) {
            this.dialogVisible = true
            this.dialogImageUrl = file
          },
          //删除图片
          handleRemove(type, index) {
            console.log(type, index);
            if (type === 'front') {
              this.form.pic = ''
            } else if (type === 'banner') {
              this.fileList = this.fileList.filter(function (item) {
                return item.Picture_Order != index
              })
            } else if (type === 'details') {
              this.fileList1 = this.fileList1.filter(function (item) {
                return item.Picture_Order != index
              })
            } else if (type === 'barcode') {
              this.fileList2 = this.fileList2.filter(function (item) {
                return item.Picture_Order != index
              })
            }
            else if (type === 'Specifications') {
              console.log(this.form.Children.article_specifications[0])
              this.form.Children.article_specifications[0].Picture_URL = ''
            }
          },
          beforeRemove(file, fileList) {
            this.fileList.pop()
          },
      
          uploadXLSX(file) {
            this.fileXlsx.push({
              name: file.name,
              url: file.type
            })
            const _this = this
            let arr = []
            var reader = new FileReader();
            reader.readAsBinaryString(file);
            reader.onload = function (e) {
              var data = e.target.result;
              var wb = XLSX.read(data, {
                type: 'binary' //以二进制的方式读取
              });
              var sheet = wb.Sheets[wb.SheetNames[0]];//sheet0代表excel表格中的第一页
              var json = XLSX.utils.sheet_to_json(sheet);//利用接口实现转换。
              json.forEach(item => {
                let isDealer = _this.isDealer(item['经销商'])
                let AbnormalChildren = [isDealer.abnormal]
                // if (arr.some(i => i.Article_Name == item['商品名称'])) {
                //   arr.forEach(i => {
                //     if (i.Article_Name == item['商品名称']) {
                //       i.Children.article_specifications.push({
                //         Article_Specifications_SerialNumber: '',
                //         Article_SerialNumber: '',
                //         Net_Content: '',  //净含量
                //         Unit_Price: item['吊牌价'] == '' ? '' : item['吊牌价'], //零售价
                //         Packing: item['SKU数量'], //SKU数量
                //         PackingSize: '', //装箱尺寸
                //         OutsidePackingSize: '', //外箱尺寸
                //         Specifications_Name: item['规格'], //规格说明
                //         Picture_URL: '',   //规格图片
                //         Dealer_SerialNumber:isDealer.Dealer_SerialNumber,
                //         Dealer_Amount:item['一件代发价'],
                //         Dealer_Article_SerialNumber:item['规格编码'],
                //         Abnormal:!AbnormalChildren.some(item => item == false),
                //       })
                //     }
                //   })
                // } else {
                  let Brand = _this.isBrand(item['品牌'])
                  let Category = _this.isCategory(item['类别'])
                  let Series = _this.isSeries(item['系列'])
                  let Item = _this.isItem(item['款型'])
                  let Unit = _this.isUnit(item['单位'])
                  let Abnormal = [Brand.abnormal, Category.abnormal, Series.abnormal, Item.abnormal, Unit.abnormal,isDealer.abnormal]
                  let arr1 = []
                  let pic = '';
                  var reg = RegExp(/;/);
                  if (reg.test(item['图片地址'])) {
                    item['图片地址'].split(';').forEach(url => {
                      if (url.charAt(0) == "M") {//主图
                        let str = url.substr(url.lastIndexOf('.'))
                        let str1 = url.replace(str, '')
                        arr1.push({
                          article_picNumber: '',
                          Article_SerialNumber: item["商品id"]+"-"+$.cookie('enterprise'),
                          Picture_Url: '/' + url,
                          Picture_Order: parseInt(str1.substr(str1.lastIndexOf('_') + 1)),
                          Picture_Type: 0,
                        })
                      } else if (url.charAt(0) == "D") {//详情图
                        let str = url.substr(url.lastIndexOf('.'))
                        let str1 = url.replace(str, '')
                        arr1.push({
                          article_picNumber: '',
                          Article_SerialNumber: item["商品id"]+"-"+$.cookie('enterprise'),
                          Picture_Url: '/' + url,
                          Picture_Order: parseInt(str1.substr(str1.lastIndexOf('_') + 1)),
                          Picture_Type: 1,
                        })
                      } else if (url.charAt(0) == "C") {//封面图
                        pic = url;
                      }
                    })
                  }
                  arr.push({
                    Article_SerialNumber: item["商品id"]+"-"+$.cookie('enterprise'),
                    Article_Name: item['商品名称'],
                    Brand_SerialNumber: Brand.Brand_SerialNumber,
                    Category_SerialNumber: Category.Category_SerialNumber,
                    Series_SerialNumber: Series.Series_SerialNumber,
                    Item_SerialNumber: Item.Item_SerialNumber,
                    Size: '',
                    Unit_Price: item['吊牌价'],
                    Picture_URL: '/' + pic,
                    Weight: '',
                    Weight_Unit: Unit.Article_Unit_SerialNumber,
                    Package_Quantity: '',
                    SKU_Package_Size: '',
                    Carton_Quantity: '',
                    ProvinceNumber:item['省份'],
                    Enterprise_Info_SerialNumber: $.cookie("enterprise"),
                    Release_Type: '0',
                    Abnormal: !Abnormal.some(item => item == false),
                    Children: {
                      article_pic: arr1,
                      article_barcode: [],
                      article_specifications: [{
                        Article_Specifications_SerialNumber: '',
                        Article_SerialNumber: item["商品id"]+"-"+$.cookie('enterprise'),
                        Net_Content: item['净含量'],  //净含量
                        Unit_Price: item['吊牌价'] == '' ? '' : item['吊牌价'], //零售价
                        Packing: item['SKU数量'] == '' ? '1' : item['SKU数量'], //装箱数
                        PackingSize: '', //装箱尺寸
                        OutsidePackingSize: '', //外箱尺寸
                        Specifications_Name: item['规格'] == '' ? '' : item['规格'], //规格说明
                        Picture_URL: '',   //规格图片
                        Dealer_SerialNumber:isDealer.Dealer_SerialNumber,
                        Dealer_Amount:item['一件代发价'],
                        Dealer_Article_SerialNumber:item['规格编码'],
                        Abnormal:!AbnormalChildren.some(item => item == false),
                      }]
                    }
                  })
                // }
                
              })
              console.log('共'+arr.length+'个商品');
              console.log(JSON.stringify(arr[0]) );
              _this.tableData = arr
            }
          },
          isBrand(str) {
            if (this.brand.some(item => item.Brand_Name == str)) {
              return { Brand_SerialNumber: this.brand.filter(item => item.Brand_Name == str)[0].Brand_SerialNumber, abnormal: true }
            } else {
              return { Brand_SerialNumber: '异常数据(' + (str?str:'') + ')', abnormal: false }
            }
          },
          isCategory(str) {
            if (this.category.some(item => item.Category_Name == str)) {
              return { Category_SerialNumber: this.category.filter(item => item.Category_Name == str)[0].Category_SerialNumber, abnormal: true }
            } else {
              return { Category_SerialNumber: '异常数据(' + (str?str:'') + ')', abnormal: false }
            }
          },
          isSeries(str) {
            if (this.series.some(item => item.Series_Name == str)) {
              return { Series_SerialNumber: this.series.filter(item => item.Series_Name == str)[0].Series_SerialNumber, abnormal: true }
            } else {
              return { Series_SerialNumber: '异常数据(' + (str?str:'') + ')', abnormal: false }
            }
          },
          isItem(str) {
            if (this.item.some(item => item.Item_Name == str)) {
              return { Item_SerialNumber: this.item.filter(item => item.Item_Name == str)[0].Item_SerialNumber, abnormal: true }
            } else {
              return { Item_SerialNumber: '异常数据(' + (str?str:'') + ')', abnormal: false }
            }
          },
          isUnit(str) {
            if (this.unit.some(item => item.Unit == str)) {
              return { Article_Unit_SerialNumber: this.unit.filter(item => item.Unit == str)[0].Article_Unit_SerialNumber, abnormal: true }
            } else {
              return { Article_Unit_SerialNumber: '异常数据(' + (str?str:'') + ')', abnormal: false }
            }
          },
          isDealer(str){
            if (this.dealer.some(item => item.Dealer_Name == str)) {
              return { Dealer_SerialNumber: this.dealer.filter(item => item.Dealer_Name == str)[0].Dealer_SerialNumber, abnormal: true }
            } else {
              return { Dealer_SerialNumber: '', abnormal: false }
            }
          },
          XlsxbeforeRemove() {
            this.fileXlsx.pop()
            this.tableData = []
          },
          getAddAction(data) {
            const _this = this;
            $.ajax({
              type: 'POST',
              url: DomainName + '/getBatchAddAction?token=' + $.cookie('token'),
              data: {
                tableName: 'article_info',
                Data: JSON.stringify(data)
              },
              complete: function (XMLHttpRequest) {
                _this.loading = false
                if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                  window.parent.document.location.href = absolutepath()  + XMLHttpRequest.getResponseHeader("CONTENTPATH");
                }
              },
              success: function (Result) {
                if (Result.Status == 'success') {
                  _this.$message.success('提交成功')
                  window.location.href = './Goods.html'
                }else {
                  console.log(Result);
                  _this.$message.error('提交失败，有重复商品')
                }
              },
              error: function () {
                _this.$message.error("操作失败，请稍后再试")
              },
              dataType: "json"
            });
          },
          submitForm1() {
            // if (!this.tableData.some(item => item.Abnormal == false)) {
              if (!this.loading) {
                this.loading = true
                this.getAddAction(this.tableData)
              }
            // } else {
            //   this.$message.error('存在异常数据')
            // }
          },
          Filter(i) {
            if (i == 1) {
              this.tableData.forEach(item => {
                if (!item.Abnormal) {
                  var reg = RegExp(/异常数据/);
                  if (reg.test(item.Brand_SerialNumber)) {      
                    item.Brand_SerialNumber = ''
                  }
                  if (reg.test(item.Category_SerialNumber)) {  
                    item.Category_SerialNumber = ''
                  }
                  if (reg.test(item.Item_SerialNumber)) {         
                    item.Item_SerialNumber = ''
                  }
                  if (reg.test(item.Series_SerialNumber)) {        
                    item.Series_SerialNumber = ''
                  }
                  if (reg.test(item.Weight_Unit)) {
                    item.Weight_Unit = ''
                  }
                  item.Abnormal = true
                }
              })
              this.$message.success("异常数据整理完成")
            } else if (i == 2) {
              this.tableData = this.tableData.filter(item => item.Abnormal)
              this.$message.success("已筛选掉异常数据")
            } else if(i == 3){
              // this.loading = true
              let Brand = [];
              let Category = [];
              let Item = [];
              let Series = [];
              let Weight = [];
              this.tableData.forEach(item => {
                if (!item.Abnormal) {
                  var reg = RegExp(/异常数据/);
                  if (reg.test(item.Brand_SerialNumber)&&this.isSome(Brand,'Brand_Name',item.Brand_SerialNumber.replace("异常数据(", "").replace(")", ""))) {
                    Brand.push({Brand_SerialNumber:'',Brand_Name:item.Brand_SerialNumber.replace("异常数据(", "").replace(")", ""),Enterprise_Info_SerialNumber: $.cookie("enterprise")})
                  }
                  if (reg.test(item.Category_SerialNumber)&&this.isSome(Category,'Category_Name',item.Category_SerialNumber.replace("异常数据(", "").replace(")", ""))) {
                    Category.push({Category_SerialNumber:'',Category_Name:item.Category_SerialNumber.replace("异常数据(", "").replace(")", ""),Enterprise_Info_SerialNumber: $.cookie("enterprise")})
                  }
                  if (reg.test(item.Item_SerialNumber)&&this.isSome(Item,'Item_Name',item.Item_SerialNumber.replace("异常数据(", "").replace(")", ""))) {
                    Item.push({Item_SerialNumber:'',Item_Name:item.Item_SerialNumber.replace("异常数据(", "").replace(")", ""),Enterprise_Info_SerialNumber: $.cookie("enterprise")})
                  }
                  if (reg.test(item.Series_SerialNumber)&&this.isSome(Series,'Series_Name',item.Series_SerialNumber.replace("异常数据(", "").replace(")", ""))) {
                    Series.push({Series_SerialNumber:'',Series_Name:item.Series_SerialNumber.replace("异常数据(", "").replace(")", ""),Enterprise_Info_SerialNumber: $.cookie("enterprise")})
                  }
                  if (reg.test(item.Weight_Unit)&&this.isSome(Weight,'Unit',item.Weight_Unit.replace("异常数据(", "").replace(")", ""))) {
                    Weight.push({Weight_Unit:'',Unit:item.Weight_Unit.replace("异常数据(", "").replace(")", ""),Enterprise_Info_SerialNumber: $.cookie("enterprise")})
                  }
                }
              })
              let _this = this
              $.ajax({
                type: 'POST',
                url: DomainName + '/getAddAction?token=' + $.cookie('token'),
                data: {
                  Data: JSON.stringify({brand:Brand.filter(i=>i.Brand_Name!=''),category:Category.filter(i=>i.Category_Name!=''),item:Item.filter(i=>i.Item_Name!=''), series:Series.filter(i=>i.Series_Name!=''), article_unit:Weight.filter(i=>i.Unit!='')})
                },
                complete: function (XMLHttpRequest) {
                  _this.loading = false
                  if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                    window.parent.document.location.href = absolutepath()  + XMLHttpRequest.getResponseHeader("CONTENTPATH");
                  }
                },
                success: function (Result) {
                  if (Result.Status == 'success') {
                    console.log('提交成功');
                    _this.$message.success("主数据更新完成")
                  }
                },
                error: function () {
                  _this.$message.error("操作失败，请稍后再试")
                },
                dataType: "json"
              }); 
            }
          },
          isSome(arr,key,str){
            for(let i = 0; i < arr.length ; i++){
              if(arr[i][key] == str){
                return false
              }
            }
            return true
          },
          tableCellStyle({ row, column, rowIndex, columnIndex }) {
            if (!row.Abnormal) return { backgroundColor: '#E6A23C' }
          },
    }
})